package com.aop.zy.aop.controller;

import com.aop.zy.aop.annotation.AroundTime;
import com.aop.zy.aop.annotation.PrintTime;
import com.aop.zy.aop.service.TimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhangyi
 * @date 2018/12/23 20:37
 */
@RestController
public class AopController {

    @Autowired
    private TimeService timeService;

    @GetMapping("/time")
    @AroundTime
    public String time(){
        String s = timeService.printTime();
        return s;
    }


    @GetMapping("/test/{s}/{aa}")
    @PrintTime
    public String test(@PathVariable String s,
                       @PathVariable Integer aa){
        System.out.println("Controller层测试");
        return "HI";
    }

    public void cyc(){
        System.out.println("切面调用方法");
    }
}
